@import '../core/theming/palette';
@import '../core/theming/theming';

@mixin md-select-theme($theme) {
  $foreground: map-get($theme, foreground);
  $background: map-get($theme, background);
  $primary: map-get($theme, primary);
  $warn: map-get($theme, warn);

  .md-select-trigger {
    color: md-color($foreground, hint-text);
    border-bottom: 1px solid md-color($foreground, divider);

    md-select:focus:not(.md-select-disabled) & {
      color: md-color($primary);
      border-bottom: 1px solid md-color($primary);
    }

    .ng-invalid.ng-touched:not(.md-select-disabled) & {
      color: md-color($warn);
      border-bottom: 1px solid md-color($warn);
    }
  }

  .md-select-arrow {
    color: md-color($foreground, hint-text);

    md-select:focus:not(.md-select-disabled) & {
      color: md-color($primary);
    }

    .ng-invalid.ng-touched:not(.md-select-disabled) & {
      color: md-color($warn);
    }
  }

  .md-select-content {
    background: md-color($background, card);
  }

  .md-select-value {
    color: md-color($foreground, text);

    .md-select-disabled & {
      color: md-color($foreground, hint-text);
    }
  }

  md-option {
    &:hover:not(.md-option-disabled), &:focus:not(.md-option-disabled) {
     background: md-color($background, hover);
    }

    &.md-selected {
      background: md-color($background, hover);
      color: md-color($primary);
    }

    &.md-option-disabled {
      color: md-color($foreground, hint-text);
    }

  }
}
